import { useAudioPlayerStore } from "~/stores/audioPlayer";

export default defineNuxtPlugin((nuxtApp) => {
  // 仅在客户端执行
  if (import.meta.client) {
    const audioStore = useAudioPlayerStore();

    // 确保只初始化一次
    if (!audioStore.isInitialized) {
      console.log("Plugin: Initializing audio store...");
      audioStore.initializeAudio();
    } else {
      console.log("Plugin: Audio store already initialized.");
    }
  }
});
